function speeds = wheelSpeeds(x, t, robot)
% calculates the linear ground speed of every wheel
stateDfn;
lea = [cos(x(STH)) -sin(x(STH)) 0; sin(x(STH)) cos(x(STH)) 0; 0 0 1];

for i = 1:robot.modules
	wheelVelocity = [x(SDX); x(SDY); 0] + lea*cross([0; 0; x(SDTH)], robot.module(i).loc); % inertial velocity at module
	speeds(i) = sqrt(wheelVelocity(1)^2 + wheelVelocity(2)^2 + wheelVelocity(3)^2); % TODO only use component in wheel direction
end

return
